home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16544 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. From: ChrisHines@msn.com (Chris Hines)
  2. Subject: Re: What are the differences between structures and classes in C++ ?
  3. Date: 11 Apr 96 05:32:17 -0700
  4. References: <4k5m65$av@hpscit.sc.hp.com> <DpG53J.Hsz@presby.edu> <4k83j3$a56@hpscit.sc.hp.com> <marnoldDpHvED.E0t@netcom.com> <31696B8E.6461@datalytics.com> <3169F3F5.4D@tarley_pc.loc201.tandem.com>
  5. Message-ID: <00001a81+0000b1d5@msn.com>
  6. Path: news.msn.com!msn.com
  7. Newsgroups: comp.lang.c++
  8. Organization: The Microsoft Network (msn.com)
  9.  
  10. >Rob Stewart wrote:
  11. >> 
  12. >> Actually, classes *are* structs, since struct came first.  Early
  13. >> debuggers would also reveal this (at least dbx on the UNIX side
  14. >> did).  What you declared a class the debugger revealed as a
  15. >> struct.
  16. >
  17. >Nope. Structs *are* classes since classes include all features of
  18. >structs _and_ additional functionality. And the fact that early
  19. >debuggers carry some rudimentary naming conventions only points
  20. >out that they were created in a hurry or by people who were too
  21. >lazy to do appropriate changes.
  22. >
  23. >Regards,
  24. >
  25. >Anatoli.
  26.  
  27. From Stroustrup's "The C++ Programming Language" page 542:  A 
  28. structure is a class declared with the class-key struct; its members 
  29. and base classes are public by default.
  30.  
  31. In other words a class and a struct are identical except for the 
  32. default accessibility of it's members.  I'm not aware of any features 
  33. that classes have that structs lack.
  34.  
  35. ------
  36. Chris Hines            ChrisHines@msn.com
  37.